<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>新闻列表</title>
    <style type="text/css">
        .usersInfo{
            display:none;
            width:200px;
            background:#eee;
            border:1px solid #333;
            position:absolute;
        }
    </style>
    <script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        $(function(){
            // 保证⻚⾯加载完成后在执⾏
            // 选择器.动作
            $(".users").hover(function(){
                $(".usersInfo",this).css("display","block");
                },function(){
                $(".usersInfo",this).css("display","none");
            });
        });
        </script>
</head>
<body>
<div>
    <div>
        <a href="/index.jsp">⾸⻚</a>/新闻
    </div>
</div>
<h1>新闻列表</h1>
<div>
    <div>
        全部结果>
        <c:if test="${params!=null}">
            <span>
                ${params.keywords}
            </span>
        </c:if>
    </div>
    <div>
        <table>

            <tr>
                <td>新闻分类</td>
                <td>
                        <span>
                               <a ${params.category_id == null ? "style=\"color: red;\"":"" }
                                       href="/news?op=list&keywords=${params.keywords}&interval=${params.interval}">
                                  全部
                               </a>
                        </span>&nbsp;
                    <c:forEach items="${categorys}" var="category">
                        <span>
                               <a ${params.category_id == category.id ? "style=\"color: red;\"":"" }
                                       href="/news?op=list&keywords=${params.keywords}&category_id=${category.id}&interval=${params.interval}">
                                ${category.name}
                               </a>
                        </span>&nbsp;
                    </c:forEach>
                </td>
            </tr>
            <tr>
                <td>发布时间</td>
                <td>
                    <span><a ${params.interval <=0 ? "style=\"color: red;\"":""}
                            href="/news?op=list&keywords=${params.keywords}&interval=0&category_id=${category.id}">最近</a></span>&nbsp;
                    <span><a ${params.interval ==1 ? "style=\"color: red;\"":""}
                            href="/news?op=list&keywords=${params.keywords}&interval=1&category_id=${category.id}">1月内</a></span>&nbsp;
                    <span><a ${params.interval ==3 ? "style=\"color: red;\"":""}
                            href="/news?op=list&keywords=${params.keywords}&interval=3&category_id=${category.id}">3月内</a></span>&nbsp;
                    <span><a ${params.interval ==6 ? "style=\"color: red;\"":""}
                            href="/news?op=list&keywords=${params.keywords}&interval=6&category_id=${category.id}">半年内</a></span>&nbsp;
                    <span><a ${params.interval ==12 ? "style=\"color: red;\"":""}
                            href="/news?op=list&keywords=${params.keywords}&interval=12&category_id=${category.id}">1年内</a></span>&nbsp;
                </td>
            </tr>

        </table>

    </div>



</div>
<table width="800" border="1">
    <tr>
        <th>编号</th>
        <th>标题</th>
        <th>内容</th>
        <th>关键字</th>
        <th>作者</th>
        <th>发布</th>
        <th>审批</th>
        <th>分类</th>
    </tr>
    <c:forEach items="${list}" var="news">
        <tr>
            <td><a href="/news?op=find&id=${news.id}">${news.id}</a></td>
            <td>${news.title}</td>
            <td>${news.content}</td>
            <td>${news.keywords}</td>
            <td class="users">${news.owner.nickname}
                <div class="usersInfo">
                    <table>
                        <tr>
                            <td>账号</td>
                            <td>${news.owner.nickname}</td>
                        </tr>
                        <tr>
                            <td>姓名</td>
                            <td>${news.owner.realname}</td>
                        </tr>
                        <tr>
                            <td>电话</td>
                            <td>${news.owner.phone}</td>
                        </tr>
                        <tr>
                            <td>邮件</td>
                            <td>${news.owner.email}</td>
                        </tr>
                        <tr>
                            <td>地址</td>
                            <td>${news.owner.address}</td>
                        </tr>
                    </table>
                </div>
            </td>
            <td>${news.pubtimeString}</td>
            <td>${news.checkUsersName}</td>
            <td>${news.categoryName}</td>
        </tr>
    </c:forEach>
</table>
</body>
</html>
